Cover | TOC | Chap | Prev Chap | Prev Fig | Next Fig | Next Chap |
![]() |
Figure 20.10
A blinking lightbulb. |
|
Click on the image to view the VRML scene. |
#VRML V2.0 utf8 # The VRML 2.0 Sourcebook # Copyright (c) 1997 # Andrea L. Ames, David R. Nadeau, and John L. Moreland Group { children [ # Generic lighting for ambience DirectionalLight { intensity 0.2 ambientIntensity 1.0 }, # Light bulb DEF BulbLight PointLight { radius 16.0 color 1.0 0.0 0.0 }, # Light bulb shape Shape { appearance Appearance { material DEF BulbColor Material { emissiveColor 1.0 0.3 0.3 diffuseColor 0.0 0.0 0.0 } } geometry DEF Bulb Sphere { } }, # Wall Transform { translation 0.0 0.0 -1.1 rotation 1.0 0.0 0.0 1.57 children Inline { url "mesh.wrl" } }, # Animation clock DEF Clock TimeSensor { cycleInterval 4.0 loop TRUE }, # Animation brightness and colors DEF BulbIntensity ScalarInterpolator { key [ 0.0, 0.5, 0.5, 1.0 ] keyValue [ 1.0, 1.0, 0.0, 0.0 ] }, DEF BulbDiffuse ColorInterpolator { key [ 0.0, 0.5, 0.5, 1.0 ] keyValue [ 0.0 0.0 0.0, 0.0 0.0 0.0, 1.0 0.3 0.3, 1.0 0.3 0.3 ] }, DEF BulbEmissive ColorInterpolator { key [ 0.0, 0.5, 0.5, 1.0 ] keyValue [ 1.0 0.3 0.3, 1.0 0.3 0.3, 0.0 0.0 0.0, 0.0 0.0 0.0, ] } ] } ROUTE Clock.fraction_changed TO BulbIntensity.set_fraction ROUTE Clock.fraction_changed TO BulbDiffuse.set_fraction ROUTE Clock.fraction_changed TO BulbEmissive.set_fraction ROUTE BulbIntensity.value_changed TO BulbLight.set_intensity ROUTE BulbDiffuse.value_changed TO BulbColor.set_diffuseColor ROUTE BulbEmissive.value_changed TO BulbColor.set_emissiveColor